package com.ys.controller;

import com.ys.pojo.Order;
import com.ys.pojo.Orderdrugcommodity;
import com.ys.service.OrderService;
import com.ys.service.OrderdrugcommodityService;
import com.ys.vo.LocalDataVo;
import com.ys.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/zOnInSearch")
public class ZOnInSearchController {
    @Resource
    private OrderService orderService;      //订单

    @Resource
    private OrderdrugcommodityService detailsService;        //订单详情


    @GetMapping("/searchOrder")
    public ResultVo searchOrder(String name1,String name2,String name3,String name4){
        List<Order> list = orderService.searchBuyAll(name1,name2,name3,name4);
        return ResultVo.success(list);
    }

    @PostMapping("/searchDetails")
    public ResultVo searchDetails(Integer orderIds){
        List<Orderdrugcommodity> list = detailsService.searchOrderIds(orderIds);
        return ResultVo.success(list);
    }
    @GetMapping("/searchAll")
    public ResultVo searchAll(){
        List<Order> list= orderService.searchAll();
        return ResultVo.success(list);
    }

    @GetMapping("/searchTyeps")
    public ResultVo searchTyeps(String types){
        List<Order> list = orderService.searchType(types);
        return ResultVo.success(list);
    }
    @PostMapping("/searchDate")
    public ResultVo searchDate(@RequestBody LocalDataVo localdata){
        List<Order> list = orderService.searchDate(localdata.getSaleDate());
        return ResultVo.success(list);
    }
}
